<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>ColumNav example: link action</title>
    <script type="text/javascript" src="../js/yui/yahoo.js"></script>
    <script type="text/javascript" src="../js/yui/event.js"></script>
    <script type="text/javascript" src="../js/yui/container_core.js"></script>
    <script type="text/javascript" src="../js/yui/dom.js"></script>
    <script type="text/javascript" src="../js/yui/animation.js"></script>
    <script type="text/javascript" src="../js/yui/connection.js"></script>
    <script type="text/javascript" src="../js/carousel.js"></script>
    <script type="text/javascript" src="../js/columnav.js"></script>
    <link href="../css/carousel.css" rel="stylesheet" type="text/css"/>
    <link href="../css/columnav.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript">
      try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
      function ask(e) {
          var target = YAHOO.util.Event.getTarget(e);
          if (target.tagName == 'SPAN')
              target = target.parentNode;
          if (confirm('Are you sure you want to visit ' + target.href + '?'))
              return true;
          else {
              target.focus();
              return false;
          }
      }
      function init() {
          var cn_cfg = { source: document.getElementById('sites'), linkAction: ask };
          var cn = new YAHOO.extension.ColumNav('columnav', cn_cfg);

          var sv_cfg = { url: location.href, modifier: 'HTML' };
          var sv = new YAHOO.extension.SourceViewer('source', sv_cfg);
      }
      YAHOO.util.Event.addListener(window, 'load', init);
    </script>
    <script type="text/javascript" src="../js/viewsource.js"></script>
    <link href="../css/stringify.css" rel="stylesheet" type="text/css"/>
  </head>
  <body>
    <div id="main">
      <div id="content">
        <p style="float:right"><a href="../">Documentation</a></p>
        <h1>ColumNav</h1>
        <h2>Example</h2>
        <div id="columnav" class="carousel-component">
          <div class="carousel-clip-region">
            <ul class="carousel-list"></ul>
          </div>
        </div>
        <div class="viewsource" id="source"></div>
        <p>The ColumNav above is initialized from the list below. When each link is clicked, the function given in the <code>linkAction</code> configuration property is run. If that function returns <code>true</code>, the link is followed in normal fashion. If <code>false</code>, the click event is canceled. The <code>linkAction</code> function receives a reference to the event that triggered the link its sole argument. It can perform any action, and should return <code>true</code> or <code>false</code>.</p>
        <ul id="sites">
          <li><a href="http://www.google.com/">Google</a></li>
          <li><a href="http://www.yahoo.com/">Yahoo</a></li>
        </ul>
      </div>
    </div>
  </body>
</html>
